package com.coincalf.wallet.entity;

import com.baomidou.mybatisplus.enums.IdType;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;

import java.io.Serializable;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * <p>
 * 充币纪录表
 * </p>
 *
 * @author crow
 * @since 2018-05-16
 */
@Data
@Accessors(chain = true)
@TableName("coin_recharge")
public class CoinRecharge extends Model<CoinRecharge> {

    private static final long serialVersionUID = 1L;

    /**
     * 自增id
     */
    @TableId(value = "id", type = IdType.AUTO)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 用户id
     */
    @TableField("user_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    /**
     * 币种id
     */
    @TableField("coin_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long coinId;

    /**
     * 币种名称
     */
    @TableField("coin_name")
    private String coinName;

    @TableField("coin_type")
    private String coinType;

    /**
     * 充币转账地址 多个则英文逗号分隔开 主要针对BTC
     */
    @TableField("from_address")
    private String fromAddress;

    /**
     * 钱包地址，即充币收款地址
     */
    @TableField("address")
    private String address;

    /**
     * 合约地址
     */
    @TableField("contract_address")
    private String contractAddress;

    /**
     * 状态
     * -1 交易失败
     * 0 待入账
     * 1 充值失败
     * 2 到账失败
     * 3 到账成功
     * 4 无效充币 低于最小充币数量
     */
    @TableField("status")
    private Integer status;

    /**
     * 充值确认数
     */
    @TableField("confirm")
    private Integer confirm;

    /**
     * 交易id
     */
    @TableField("txid")
    private String txid;

    /**
     * 充值量
     */
    @TableField("num")
    private BigDecimal num;

    /**
     * 手续费
     */
    @TableField("fee")
    private BigDecimal fee;

    /**
     * 实际到账
     */
    @TableField("mum")
    private BigDecimal mum;

    /**
     * 交易的区块高度
     */
    @TableField("block_number")
    private Integer blockNumber;

    /**
     * 是否归集
     * 0否 1是 2不需要归集
     */
    private Integer collected;

    /**
     * memo 针对EOS和XRP(tag)
     */
    private String memo;

    /**
     * 修改时间
     */
    @TableField("last_update_time")
    private Date lastUpdateTime;

    /**
     * 创建时间
     */
    @TableField("created")
    private Date created;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
